package com.qtcm.nas.zhb.bendianyuyue.web;


import com.qtcm.nas.zhb.bendianyuyue.pojo.Subscribe;

import com.qtcm.nas.zhb.bendianyuyue.service.ISubscriService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller("subscribeConller")
@RequestMapping("/yuyue")
public class SubscribeConller {
    @Autowired
    @Qualifier("subscriService")
    private ISubscriService subscriService;

    //本店预约查询所有
    @RequestMapping(value ="/findsubAll")
    public String findAll(Model model){
        List<Subscribe> sub = subscriService.findAll();
        for (Subscribe a:sub){
            System.out.println(a.toString());
        }
        model.addAttribute("sub",sub);
        return "Appointment";
    }

    //本店预约单个查询
    @RequestMapping(value = "/dqc")
    public String SubById(Model model,int G_Appointment_no){
        Subscribe sub = subscriService.subById(G_Appointment_no);
        model.addAttribute("sub",sub);
        return "appoint_Detail";
    }

    //本店预约修改
    @RequestMapping(value = "/updateyy")
    public String ubupda(Subscribe subscribe){
        System.out.println("12");
        subscriService.ubupda(subscribe);
        return "forward:findsubAll";
    }
    //本店预约模糊查询
    @RequestMapping(value = "/mhcx")
    public String mhcx(Subscribe subscribe,Model model){
        System.out.println(subscribe);
        List<Subscribe> sublist = subscriService.fuzzy(subscribe);
        System.out.println(sublist);
        model.addAttribute("sub",sublist);
        return "Appointment";
    }
    //本店预约今日预约
    @RequestMapping(value = "/jryy")
    public String makejr(Model model){
        List<Subscribe> li = subscriService.make();
        System.out.println(li);
        model.addAttribute("yy",li);
        return "Hello";
    }
}

